package jax.lang;

/**
 * ...
 * @author tom
 */
class JRuntime implements haxe.Public {
	function new () {
	}
	static var runtime = new JRuntime();
	
	static function gc() {
		jax.JVM.gc();
	}
	static function exit(code:Int) {
		jax.JVM.classes = new Hash<jax.lang.JClass>();
		jax.JVM.gc();
		halt(code);
	}
	static function halt(code:Int) {
		#if sys
			Sys.exit(code);
		#else
			throw "Program halted with code: "+code;
		#end
	}
	static function availableProcessors():Int {
		return 1;
	}
	static function usedMemory():haxe.Int64 {
		return haxe.Int64.ofInt(1);
	}
	static function maxMemory():haxe.Int64 {
		return haxe.Int64.ofInt(999);
	}
	static function totalMemory():haxe.Int64 {
		return haxe.Int64.ofInt(1000);
	}
}
